home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-23 | 1.6 KB | 94 lines | [TEXT/CWIE] |
- #include "Shell.h"
- #include "CFlock.h"
- #include "FlockDrawing.h"
- #include "FinderFun.h"
-
-
- Boolean gDoneFlag = false;
- RgnHandle gWorldRgn = NewRgn();
-
- // finder stuff
- long gNumItems = 0;
- Handle gIcons[kMaxBoids];
- Handle gMasks[kMaxBoids];
- Point gPositions[kMaxBoids];
- Rect gWindowRect;
- long gWindowView;
-
- // The global flock
- CFlock *gTheFlock;
-
- void InitParamBlock(void);
-
- void main (void)
- {
- EventRecord theEvent;
- CursHandle Curs;
- short err;
- unsigned long seed;
- long dum;
-
- FlushEvents (everyEvent - diskMask, 0 );
- MaxApplZone();
- InitGraf (&qd.thePort);
- InitFonts ();
- InitWindows ();
- InitMenus ();
- TEInit ();
- InitDialogs (nil);
- InitCursor ();
-
- /* Make a buncha Master pointers */
-
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters(); // Enough? :-)
-
- Curs = GetCursor(watchCursor);
- SetCursor(*Curs);
-
- // Get finder junk
- err = GatherFinderInfo(kMaxBoids);
- if(err)
- ExitToShell();
-
- // Set up drawing to use Draw Sprocket. Also sets up the
- // world region.
- err = SetUpDrawing(gWorldRgn);
- if(err)
- ExitToShell();
-
- /* Reset random number generator */
- GetDateTime(&seed);
- qd.randSeed = seed;
-
- // OK, make the Flock
- gTheFlock = (CFlock *)(new CFlock)->InitFlock(gWorldRgn);
- SetCursor(&qd.arrow);
-
- if(gTheFlock != nil)
- {
- while(!gDoneFlag)
- {
- WaitNextEvent(everyEvent, &theEvent, 0, nil);
- DoEvent(&theEvent);
- }
- // close down flock
- gTheFlock->KillFlock(gWorldRgn);
- delete gTheFlock;
- gTheFlock = nil;
-
- }
- else SysBeep(10);
-
-
- // Close down Draw Sprocket
- err = CloseDownDrawing();
- }
-
-